# 使用官方PaddlePaddle镜像
FROM paddlepaddle/paddle:2.6.0

# 设置中文环境
RUN apt-get update && \
    apt-get install -y locales && \
    sed -i '/zh_CN.UTF-8/s/^# //g' /etc/locale.gen && \
    locale-gen zh_CN.UTF-8
ENV LANG zh_CN.UTF-8

# 安装系统依赖
RUN apt-get install -y --no-install-recommends \
    libgl1 \
    libglib2.0-0 \
    python3-dev \
    python3-pip

# 设置工作目录
WORKDIR /app

# 复制文件
COPY app/requirements.txt .
COPY app ./app
COPY config.py .

# 安装Python依赖
RUN pip3 install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

# 暴露端口
EXPOSE 5000

# 启动命令
CMD ["gunicorn", "-b", "0.0.0.0:5000", "--workers=4", "app.ocr_api:app"]